import $ from "@/utils/request"
// 首页数据

const loginData = (obj) => $.postAxios("login", obj)

// 数据管理
const dataAdministration = () => $.getAxios("shopping/getcategory/2", { restaurant_id: '' })

// 订单数据
const orderList = (pagenum,pagesize)=>$.getAxios("orders",{pagenum,pagesize});
const dataRes = ()=>$.getAxios("reports/type/1")


// 营销数据
	
// 权限数据


// 用户列表
const UsersListData = (obj) => $.getAxios("users/", { pagenum: obj.pageNum1, pagesize: obj.totalNum })
// 添加用户
const addUsers = (obj) => $.postAxios("users/", { username: obj.addUsername1, password: obj.addPassword1, email: obj.addEmail1, mobile: obj.addPMobile1, })
// 编辑用户
const emitUsers = (obj) => $.putAxios("users/" + obj.id, { email: obj.email, mobile: obj.mobile })
// 删除用户
const delUsers = (obj) => $.deleteAxios("users/" + obj)
// 搜索用户
const searchUsers = (admin) => $.getAxios("users/", { query: admin, pagenum: 1, pagesize: 10 })
// 修改用户状态
const update = (obj) => $.putAxios("users/" + obj.upId + "state/" + obj.stateUp)


// 角色列表
const RoleListData = () => $.getAxios("roles/", { roleName: 1 })
// 添加角色
const addRoles = (obj) => $.postAxios("roles/", { roleName: obj.roleName1, roleDesc: obj.roleDesc1 })
// 编辑角色
const emitRoles = (obj) => $.putAxios("roles/" + obj.id, { roleName: obj.emailEmit, roleDesc: obj.mobileEmit })
// 删除角色
const delRoles = (obj) => $.deleteAxios("roles/" + obj,)



const classifyArgData = (obj) => $.getAxios("categories",obj)
const getList = () => $.getAxios('users', { pagenum: 1, pagesize: 10 })
//权限管理
const getListPer = () => $.getAxios('rights/list')
//商品列表
const getCategories = (obj) => $.getAxios('goods', obj)
//商品分类
const getClassify = () => $.getAxios('categories');
//商品参数
const getGoodsattr = (ids) => $.getAxios('categories/' + ids + '/attributes?sel=many')
const getGoodsattrList = (ids) => $.getAxios('categories/' + ids + '/attributes?sel=only')
//图片上传
const postImgs = () => $.postAxios('upload')
//添加商品
const postGoods = (obj) => $.postAxios('goods', { goods_name: obj.name, goods_price: obj.price, goods_number: obj.num, goods_weight: obj.weight, goods_cat: '' })

export default {postGoods, postImgs, getGoodsattrList, getGoodsattr, getList, getListPer, getCategories, getClassify , loginData,orderList,dataRes,update, searchUsers, addUsers, delUsers, emitUsers, delRoles, emitRoles, addRoles, RoleListData, loginData, dataAdministration, UsersListData }
